#!/usr/bin/env python
# coding: utf-8

# In[1]:


import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import math
from scipy.stats import skew


# In[2]:


df = pd.read_csv("D:/research/recordbreak/climatology/river_all.csv", index_col=0)
print(df)


# In[3]:


#df.set_index('date', inplace=True)
#df.index = pd.to_datetime(df.index)


# # Indus

# In[4]:


# Plot the indus climatology 1981-2010
fig, ax = plt.subplots(figsize=(20, 10))

# Plot ind_obs
plt.plot(df.index, df['ind_obs'], marker='o', markersize=12, linestyle='-', color='black', label='Observed', linewidth=5)

# Plot ind45_p50
plt.plot(df.index, df['ind45_p50'], marker='o', markersize=12, linestyle='-', color='blue', label='CORDEX-SA', linewidth=4)

# Plot CI 5-95%
plt.fill_between(df.index, df['ind45_p5'], df['ind45_p95'], alpha=0.2, color='blue') 


# Plot ind45_p5
#plt.plot(df.index, df['ind45_p5'], marker='s', linestyle='--', color='r', label='ind45_p5')
# Plot ind45_p95
#plt.plot(df.index, df['ind45_p95'], marker='x', linestyle=':', color='purple', label='ind45_p95')
#plt.title('streamflow climatology')

#plt.xlabel('Month', fontsize=30)
#plt.ylabel('Streamflow ($m^3/sec$)', fontsize=30)

plt.xticks(fontsize=30)  # ,fontweight='bold'
plt.yticks(fontsize=30)
plt.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
plt.gca().tick_params(axis='x', which='major', length=16, width=4)  # Set the desired length and width
plt.gca().tick_params(axis='y', which='major', length=16, width=4)

# Increase the thickness of the border around the plot
for spine in plt.gca().spines.values():
    spine.set_linewidth(4)

# Adding a legend
#plt.legend(loc='upper right', prop={'size': 26})
legend = plt.legend(loc='upper right', prop={'size': 30}, bbox_to_anchor=(0.99, 0.98), borderaxespad=0.)
legend.get_frame().set_linewidth(4)
legend.get_frame().set_edgecolor('black') 
plt.ylim(-2000, 47000)
plt.xlim(-0.1, 11.1)
ax.yaxis.grid(True, linestyle='--', linewidth=1)
plt.show()


# # Kabul

# In[5]:


# Plot the Kabul climatology 1981-2010
fig, ax = plt.subplots(figsize=(20, 10))

# Plot ind_obs
plt.plot(df.index, df['kab_obs'], marker='o', markersize=12, linestyle='-', color='black', label='Observed', linewidth=5)

# Plot ind45_p50
plt.plot(df.index, df['kab45_p50'], marker='o', markersize=12, linestyle='-', color='blue', label='CORDEX-SA', linewidth=4)

# Plot CI 5-95%
plt.fill_between(df.index, df['kab45_p5'], df['kab45_p95'], alpha=0.2, color='blue') 


# Plot ind45_p5
#plt.plot(df.index, df['kabd45_p5'], marker='s', linestyle='--', color='r', label='ind45_p5')
# Plot ind45_p95
#plt.plot(df.index, df['kab45_p95'], marker='x', linestyle=':', color='purple', label='ind45_p95')
#plt.title('streamflow climatology')

#plt.xlabel('Month', fontsize=30)
#plt.ylabel('Streamflow ($m^3/sec$)', fontsize=30)

plt.xticks(fontsize=30)  # ,fontweight='bold'
plt.yticks(fontsize=30)
plt.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
plt.gca().tick_params(axis='x', which='major', length=16, width=4)  # Set the desired length and width
plt.gca().tick_params(axis='y', which='major', length=16, width=4)

# Increase the thickness of the border around the plot
for spine in plt.gca().spines.values():
    spine.set_linewidth(4)

# Adding a legend
#plt.legend(loc='upper right', prop={'size': 26})
legend = plt.legend(loc='upper right', prop={'size': 30}, bbox_to_anchor=(0.99, 0.98), borderaxespad=0.,ncol=2)
legend.get_frame().set_linewidth(4)
legend.get_frame().set_edgecolor('black') 
plt.ylim(-500, 6700)
plt.xlim(-0.1, 11.1)
ax.yaxis.grid(True, linestyle='--', linewidth=1)
plt.show()


# # Jehlum

# In[6]:


# Plot the Jehlum climatology 1981-2010
fig, ax = plt.subplots(figsize=(20, 10))

# Plot ind_obs
plt.plot(df.index, df['jeh_obs'], marker='o', markersize=12, linestyle='-', color='black', label='Observed', linewidth=5)

# Plot ind45_p50
plt.plot(df.index, df['jeh45_p50'], marker='o', markersize=12, linestyle='-', color='blue', label='CORDEX-SA', linewidth=4)

# Plot CI 5-95%
plt.fill_between(df.index, df['jeh45_p5'], df['jeh45_p95'], alpha=0.2, color='blue') 


# Plot ind45_p5
#plt.plot(df.index, df['kabd45_p5'], marker='s', linestyle='--', color='r', label='ind45_p5')
# Plot ind45_p95
#plt.plot(df.index, df['kab45_p95'], marker='x', linestyle=':', color='purple', label='ind45_p95')
#plt.title('streamflow climatology')

#plt.xlabel('Month', fontsize=30)
#plt.ylabel('Streamflow ($m^3/sec$)', fontsize=30)

plt.xticks(fontsize=30)  # ,fontweight='bold'
plt.yticks(fontsize=30)
plt.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
plt.gca().tick_params(axis='x', which='major', length=16, width=4)  # Set the desired length and width
plt.gca().tick_params(axis='y', which='major', length=16, width=4)

# Increase the thickness of the border around the plot
for spine in plt.gca().spines.values():
    spine.set_linewidth(4)

# Adding a legend
#plt.legend(loc='upper right', prop={'size': 26})
#legend = plt.legend(loc='upper right', prop={'size': 30}, bbox_to_anchor=(0.99, 0.98), borderaxespad=0.)
#legend.get_frame().set_linewidth(4)
#legend.get_frame().set_edgecolor('black') 
plt.ylim(-500, 6700)
plt.xlim(-0.1, 11.1)
ax.yaxis.grid(True, linestyle='--', linewidth=1)
plt.show()


# # Chenab

# In[7]:


# Plot the Chenab climatology 1981-2010
fig, ax = plt.subplots(figsize=(20, 10))

# Plot ind_obs
plt.plot(df.index, df['che_obs'], marker='o', markersize=12, linestyle='-', color='black', label='Observed', linewidth=5)

# Plot ind45_p50
plt.plot(df.index, df['che45_p50'], marker='o', markersize=12, linestyle='-', color='blue', label='CORDEX-SA', linewidth=4)

# Plot CI 5-95%
plt.fill_between(df.index, df['che45_p5'], df['che45_p95'], alpha=0.2, color='blue') 


# Plot ind45_p5
#plt.plot(df.index, df['kabd45_p5'], marker='s', linestyle='--', color='r', label='ind45_p5')
# Plot ind45_p95
#plt.plot(df.index, df['kab45_p95'], marker='x', linestyle=':', color='purple', label='ind45_p95')
#plt.title('streamflow climatology')

#plt.xlabel('Month', fontsize=30)
#plt.ylabel('Streamflow ($m^3/sec$)', fontsize=30)

plt.xticks(fontsize=30)  # ,fontweight='bold'
plt.yticks(fontsize=30)
plt.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
plt.gca().tick_params(axis='x', which='major', length=16, width=4)  # Set the desired length and width
plt.gca().tick_params(axis='y', which='major', length=16, width=4)

# Increase the thickness of the border around the plot
for spine in plt.gca().spines.values():
    spine.set_linewidth(4)

# Adding a legend
#plt.legend(loc='upper right', prop={'size': 26})
#legend = plt.legend(loc='upper right', prop={'size': 30}, bbox_to_anchor=(0.99, 0.98), borderaxespad=0.)
#legend.get_frame().set_linewidth(4)
#legend.get_frame().set_edgecolor('black') 
plt.ylim(-500, 6700)
plt.xlim(-0.1, 11.1)
ax.yaxis.grid(True, linestyle='--', linewidth=1)
plt.show()


# In[ ]:





# In[ ]:





# In[ ]:





# In[ ]:





# In[ ]:




